﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Digitalmes.Model.PlanningManagement;
using Digitalmes.Model;

namespace Digitalmes.ViewModel.PlanningManagement.ProductionOrderVMs
{
    public partial class ProductionOrderTemplateVM : BaseTemplateVM
    {
        
        [Display(Name = "_Model._ProductionOrder._ProductId")]
        public ExcelPropety ProductId_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ProductId);
        [Display(Name = "_Model._ProductionOrder._ProductName")]
        public ExcelPropety ProductName_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ProductName);
        [Display(Name = "_Model._ProductionOrder._Wo")]
        public ExcelPropety Wo_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.Wo);
        [Display(Name = "_Model._ProductionOrder._OnlineQty")]
        public ExcelPropety OnlineQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.OnlineQty);
        [Display(Name = "_Model._ProductionOrder._QualifiedQty")]
        public ExcelPropety QualifiedQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.QualifiedQty);
        [Display(Name = "_Model._ProductionOrder._PlanStartTime")]
        public ExcelPropety PlanStartTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.PlanStartTime, true);
        [Display(Name = "_Model._ProductionOrder._PlanEndTime")]
        public ExcelPropety PlanEndTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.PlanEndTime, true);
        [Display(Name = "_Model._ProductionOrder._ActualStartTime")]
        public ExcelPropety ActualStartTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ActualStartTime, true);
        [Display(Name = "_Model._ProductionOrder._ActualEndTime")]
        public ExcelPropety ActualEndTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ActualEndTime, true);
        [Display(Name = "_Model._ProductionOrder._Sort")]
        public ExcelPropety Sort_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.Sort);
        [Display(Name = "_Model._ProductionOrder._ProductCode")]
        public ExcelPropety ProductCode_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ProductCode);
        [Display(Name = "_Model._ProductionOrder._OrderStatus")]
        public ExcelPropety OrderStatus_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.OrderStatus);
        [Display(Name = "_Model._ProductionOrder._OrderSource")]
        public ExcelPropety OrderSource_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.OrderSource);
        [Display(Name = "_Model._ProductionOrder._Plan")]
        public ExcelPropety Plan_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.PlanId);
        [Display(Name = "_Model._ProductionOrder._PlanQty")]
        public ExcelPropety PlanQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.PlanQty);
        [Display(Name = "_Model._ProductionOrder._CompletedQty")]
        public ExcelPropety CompletedQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.CompletedQty);
        [Display(Name = "_Model._ProductionOrder._UnqualifiedQty")]
        public ExcelPropety UnqualifiedQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.UnqualifiedQty);
        [Display(Name = "_Model._ProductionOrder._ScrapQty")]
        public ExcelPropety ScrapQty_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.ScrapQty);
        [Display(Name = "_Model._ProductionOrder._CreateTime")]
        public ExcelPropety CreateTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.CreateTime, true);
        [Display(Name = "_Model._ProductionOrder._UpdateTime")]
        public ExcelPropety UpdateTime_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.UpdateTime, true);
        [Display(Name = "_Model._ProductionOrder._CreateBy")]
        public ExcelPropety CreateBy_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.CreateBy);
        [Display(Name = "_Model._ProductionOrder._UpdateBy")]
        public ExcelPropety UpdateBy_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.UpdateBy);
        [Display(Name = "_Model._ProductionOrder._IsValid")]
        public ExcelPropety IsValid_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.IsValid);
        [Display(Name = "_Model._ProductionOrder._TenantCode")]
        public ExcelPropety TenantCode_Excel = ExcelPropety.CreateProperty<ProductionOrder>(x => x.TenantCode);

	    protected override void InitVM()
        {
            
            Plan_Excel.DataType = ColumnDataType.ComboBox;
            Plan_Excel.ListItems = DC.Set<ProductionPlanning>().GetSelectListItems(Wtm, y => y.TenantCode.ToString());

        }

    }

    public class ProductionOrderImportVM : BaseImportVM<ProductionOrderTemplateVM, ProductionOrder>
    {
            //import

    }

}